package com.leyikao.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.leyikao.dao.TempletInfoMapper;
import com.leyikao.entity.Templet;
import com.leyikao.utils.DataSource;

@Component
public class TempletService{
	
	@Resource
	private TempletInfoMapper templetInfoMapper;
	
	@DataSource("read")
	public List<Templet> getReadAll(){
		//手动切换数据源
//		DataSourceSwitcher.setDataSourceType("write");
		return templetInfoMapper.getAll();
	}
	
	@DataSource("write")
	public List<Templet> getWriteAll(){
		//手动切换数据源
//		DataSourceSwitcher.setDataSourceType("write");
		return templetInfoMapper.getAll();
	}
	
}
